import React,{useState,useEffect} from 'react';

import './App.css';


interface Todo {

  title:String,
  status:boolean
}


function App() {

  const [todo,setTodo] = useState([]);

  useEffect( () => {

    fetch('http://127.0.0.1:1314/todo').then( res => {
      
      return res.json();
    }).then( data => {
      // console.log('data',data.todoList);
      setTodo(data.todoList);
    })
  },[])

  return (
    <div className="App">
      <ul>
      {
        todo.map((item:Todo,index) => {

          return <li key={index}>{item.title}</li>
        })
      }
      </ul>
    </div>
  );
}

export default App;
